<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 不定参函数,形参不固定从arguments中取得函数
        function sum() {
            var result = 0;
            for (var i = 0; i < arguments.length; i++) {
                result += arguments[i];
            }
            return result;
        }
        console.log(sum(1, 2, 3, 4, 5, 6));
    </script>
</body>

</html>